package com.zyht.bank.wechat.http;

import com.wx.model.BussinessException;

/**
 * ajax函数
 * 
 * @author dingyaming
 * 
 * @param <T>
 */
public interface AjaxMain<T extends ResObject> {
	/**
	 * ajax 接口封装
	 * 
	 * @param res
	 *            返回值
	 * @throws BussinessException
	 *             调用者捕获异常 并推送到对象
	 */
	void exe(T res) throws BussinessException;

	default void setSuccess(T res, String msg) {
		res.setCode(EnumCode.success);
		res.setMsg(msg);
		return;
	}

	default void setError(T res, String msg) {
		res.setCode(EnumCode.error);
		res.setMsg(msg);
		return;
	}

}
